package com.dyz.leetcode._01_array;

public class _26_removeDuplicates {
    //使用双指针
    public int removeDuplicates(int[] nums) {
        int n = nums.length;
        if(n<=1){return n;}
        int start = 0;
        int end = 1;
        while(end<n){
            if (nums[start]!=nums[end]){
                start++;
                nums[start]=nums[end];
            }
            end++;
        }
        return start+1;
    }
}
